package ru.compft.testing;

import ru.compft.services.TestingService;
import ru.compft.testing.utils.JavaTestBuilder;

import java.util.List;

/**
 * User: VVasiliev
 * Date: 23.08.2011
 * Time: 15:31:35
 * <p/>
 * Реализация сервиса для модуля тестирования
 */
public class TestingServiceImpl implements TestingService {
    @Override
    public boolean addTest(String topic, String level, String question) {
        final JavaTestBuilder testBuilder = new JavaTestBuilder(topic, level, question);
        return testBuilder.buildTest();
    }

    @Override
    public int countTest() {
        return JavaTestBuilder.countAllTests();
    }

    @Override
    public void persistAll() {
        JavaTestBuilder.writeTests();
    }

    @Override
    public List getAllTests() {
        return JavaTestBuilder.getAllTests();
    }

    @Override
    public void readAll() {
        JavaTestBuilder.readTests();
    }
}
